package router

import (
	"github.com/gin-gonic/gin"
	jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
	apisadmin "tuowei.com/app/admin/apis"
	"tuowei.com/app/api/apis"
	"tuowei.com/common/middleware"
)

func init() {
	routerNoCheckRole = append(routerNoCheckRole, registerSysCourseRouter, registerSysCourseCheckRouter)
	routerCheckRole = append(routerCheckRole, registerSysCourseNeedCheckRouter)

}

func registerSysCourseNeedCheckRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
	api := apis.SysCourse{}
	r := v1.Group("/course").Use(authMiddleware.MiddlewareFunc()).Use(middleware.CheckLogin)
	r.POST("/watch", api.Watch)
}
func registerSysCourseCheckRouter(v1 *gin.RouterGroup) {
	//在线课程详情
	apisc := apis.SysCourse{}
	r := v1.Group("/course")
	r.GET("/:id", apisc.Get)
	// 记录观看时间，redis缓存，这种东西没要落地db

	//精品课程详情
	v1auth := v1.Group("/index")
	v1auth.GET("/boutique/course/:id", apisc.Get)

}
func registerSysCourseRouter(v1 *gin.RouterGroup) {
	api := apisadmin.SysCourse{}
	r := v1.Group("/course")
	//获取选购课程列表-在线，直播,首页复用接口
	r.POST("/get", api.GetPagesApp)
	//获取选购课程列表-面授，首页复用接口
	apio := apisadmin.SysOfflineCourse{}
	ro := v1.Group("/offline/course")
	{
		ro.POST("/get", apio.GetPagesApp)
		ro.GET("/:id", apio.Get)
	}

}
